const dotenv = require('dotenv');
const result = dotenv.config();
if (result.error) {
    throw result.error;
}

const address = process.env.address;
if (!address) {
    console.log('Please configure the address in .env file');
}
const privateKey = process.env.private_key;
if (!privateKey) {
    console.log('Please configure the private_key in .env file');
}

const loopSeconds = process.env.loop_seconds || 1;
const rpc = process.env.RPC || "https://bsc-dataseed.binance.org/";

const racaContract = "0x12bb890508c125661e03b09ec06e404bc9289040";
const metamonPayAddress = "0xfE55F08aF9735D48a1150d6f26c7B6AA9ADaEAa9";
const racaPayCount = process.env.raca_pay_count || 1;
const enemyId = process.env.enemy || 0;
const autoUpgrade = process.env.auto_upgrade || 1;
const accessToken = process.env.access_token;
const upgradeLevel = process.env.upgrade_level || 0;
const battleQueue = process.env.battle_queue || 1;
const upperAttrType = process.env.upper_attr_type || 1;

const chain_bsc = {
    chainId: 56,
    rpc: rpc,
    gasLimit: 60000,
    gasPrice: "5" + "000000000",
}

const config = {
    address: address,
    privateKey: privateKey,
    chain: chain_bsc,
    loopSeconds: loopSeconds,
    racaContract: racaContract,
    metamonPayAddress: metamonPayAddress,
    racaPayCount: racaPayCount,
    enemyId: enemyId,
    autoUpgrade: autoUpgrade,
    accessToken: accessToken,
    upgradeLevel: upgradeLevel,
    battleQueue: battleQueue,
    upperAttrType: upperAttrType
}

module.exports = config